home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / text / misc / pcal_4_5.lha / pcal / calendar next >
Text File  |  1994-10-16  |  13KB  |  357 lines

  1. # Sample date file for Pcal: this should be called .calendar for Un*x,
  2. # CALENDAR.DAT for VMS, and should live in the user's home directory.
  3. #
  4. # Date file syntax:
  5. #
  6. #    1) Basic Syntax:
  7. #
  8. #    The following rules describe the syntax of date file entries:
  9. #
  10. #      year <year>
  11. #
  12. #      opt <options>
  13. #
  14. #      note{/<number>} <month_spec> <text>
  15. #      note{/<number>} <month> <text>
  16. #
  17. #      if -A flag (American date formats) specified:
  18. #        <month_name> <day>{*} {<text>}
  19. #        <month><sep><day>{<sep><year>}{*} {<text>}
  20. #
  21. #      if -E flag (European date formats) specified:
  22. #        <day>{<sep>} <month_name>{*} {<text>}
  23. #        <day>{<sep>} <month>{<sep>}{*} {<text>}
  24. #        <day><sep><month>{<sep><year>}{*} {<text>}
  25. #
  26. #      <ordinal> <day_name> in <month_spec>{*} {<text>}
  27. #      {<ordinal>} <day_name> <prep> <date_spec>
  28. #
  29. #      <holiday>
  30. #
  31. #    where
  32. #
  33. #      {x}          means x is optional
  34. #
  35. #      <date_spec> := any of the above date specs (not year, note, or opt)
  36. #      <month_name> := first 3+ characters of name of month, or "all"
  37. #      <month_spec> := <month_name>, or "year"
  38. #      <day_name> := first 3+ characters of name of weekday, "day",
  39. #            "weekday", "workday", "holiday", "nonweekday",
  40. #            "nonworkday", "nonholiday", "new_moon",
  41. #            "first_quarter", "full_moon", or "last_quarter"
  42. #      <ordinal> := ordinal number ("1st", "2nd", etc.), "first" .. "fifth",
  43. #            "last", "even", "odd", or "all"
  44. #      <prep> := "before", "preceding", "after", "following", "nearest",
  45. #            "on_or_before", or "on_or_after"
  46. #      <holiday> := "Christmas", "Thanksgiving", etc.
  47. #
  48. #      <sep> := one or more non-numeric, non-space, non-'*' characters
  49. #      <month>, <day>, <year> are the numeric forms
  50. #
  51. #      <options> := any command-line option except -[cefhuvDU]
  52. #
  53. #    Comments start with '#' (unless escaped by '\') and run through
  54. #    end-of-line.
  55. #
  56. #    Holidays may be flagged by specifying '*' as the last character of the
  57. #    date field(s), e.g. "10/12* Columbus Day", "July 4* Independence
  58. #    Day", etc.  Any dates flagged as holidays will be printed in gray, and
  59. #    any associated text will appear adjacent to the date.
  60. #
  61. #    Note that the numeric date formats (mm/dd{/yy}, dd.mm{.yy}) support an
  62. #    optional year, which will become the subsequent default year.  The
  63. #    alphabetic date formats (month dd, dd month) do not support a year
  64. #    field; the "year yy" command is provided to reset the default year.
  65. #
  66. #    European dates may also be specified as "dd. mm." and "dd. month" if
  67. #    desired.
  68. #
  69. #    "Floating" days may be specified in the date file as "first Mon in
  70. #    Sep", "last Mon in May", "4th Thu in Nov", etc.; any word may be used
  71. #    in place of "in".  "Relative floating" days (e.g. "Fri after 4th Thu
  72. #    in Nov") are also accepted; they may span month/year bounds.  Pcal
  73. #    also accepts date specs such as "all Friday{s} in October", "last
  74. #    Thursday in all", etc., and produces the expected results; "each" and
  75. #    "every" are accepted as synonyms for "all".  Negative ordinals are
  76. #    allowed; "-2nd" means "next to last".
  77. #
  78. #    "Floating" days may also be specified relative to a fixed date:
  79. #    "fourth Sunday before 12/25", etc; note, however, that only positive
  80. #    ordinals are meaningful in this context.
  81. #
  82. #    The words "day", "weekday", "workday", and "holiday" may be used as
  83. #    wildcards: "day" matches any day, "weekday" matches any day normally
  84. #    printed in black, "workday" matches any day normally printed in black
  85. #    and not explicitly flagged as a holiday, and "holiday" matches any day
  86. #    explicitly flagged as a holiday.  "Nonweekday", "nonworkday", and
  87. #    "nonholiday" are also supported and have the obvious meanings.  Moon
  88. #    phases may also appear as wildcards; "nm" is accepted as a synonym for
  89. #    "new_moon", "1q" and "fq" for "first_quarter", "fm" for "full_moon",
  90. #    and "3q", "lq", and "third_quarter" for "last_quarter".
  91. #
  92. #    "Odd" and "even" do not refer to the actual date; instead, "odd" means
  93. #    "alternate, starting with the first"; "even" means "alternate,
  94. #    starting with the second".  Thus, "odd Fridays in March" refers to the
  95. #    first, third, and (if present) fifth Fridays in March - not to those
  96. #    Fridays falling on odd dates.
  97. #
  98. #    "All" refers to each individual month; "year" refers to the year as an
  99. #    entity.  Thus "odd Fridays in all" refers to the first/third/ fifth
  100. #    Friday of each month, while "odd Fridays in year" refers to the first
  101. #    Friday of January and every other Friday thereafter.
  102. #
  103. #    Additional notes may be propagated to an empty calendar box by the
  104. #    inclusion of one or more lines of the form "note{/<number>} <month>
  105. #    <text>", where <month> may be numeric or alphabetic; "note{/<number>}
  106. #    all <text>" propagates <text> to each month in the current year.
  107. #    <number> is an optional positive or negative number specifying the
  108. #    empty box where the associated text is to be placed: if positive,
  109. #    Pcal counts forward from the first empty box; if negative, Pcal counts
  110. #    backward from the last empty box.  Thus, "note/1 ..."  places the
  111. #    associated text in the first empty box, and "note/-3 ..."  in the
  112. #    third-to-last; the default is -1 (last empty box).  (Note that if the
  113. #    -S option is used, it must be specified either on the command line or
  114. #    prior to any "note" lines in the date file.)
  115. #
  116. #
  117. #    2) Format specifiers:
  118. #
  119. #    Pcal also allows format specifiers in the text (and foot strings - cf.
  120. #    the -L, -C, -R, and -N options); each will be replaced by its
  121. #    equivalent string as outlined in the table below.  (Most of these are
  122. #    derived from the strftime() function; %[lnouwMD0+-] are Pcal-specific.)
  123. #
  124. #        %a : abbreviated weekday
  125. #        %A : full weekday
  126. #        %b : abbreviated month name
  127. #        %B : full month name
  128. #        %d : day of month (1-31)
  129. #        %j : day of year (1-366)
  130. #        %l : days left in year (0-365)
  131. #        %m : month (1-12)
  132. #        %u : week number (1-54)
  133. #        %U : week number (0-53)
  134. #        %w : week number (1-54)
  135. #        %W : week number (0-53)
  136. #        %y : year w/o century (00-99)
  137. #        %Y : year w/century
  138. #        %% : '%' character
  139. #
  140. #        %o : print number as ordinal
  141. #        %0 : print number with leading zeroes
  142. #        %+ : use following month or year
  143. #        %- : use previous month or year
  144. #        %{+N}[DWMY] : adjust date by +N days/weeks/months/years
  145. #        %{-N}[DWMY] : adjust date by -N days/weeks/months/years
  146. #
  147. #    %u considers the week containing 1/1 as week 1 and the following
  148. #    logical Sunday (the first day of the week as printed; cf. the -F
  149. #    flag) as the start of week 2; %U considers the first logical Sunday as
  150. #    the first day of week 1.  %w and %W behave like %u and %U
  151. #    respectively, but use the first logical Monday instead.  (Note that %w
  152. #    has a different meaning to strftime().)
  153. #
  154. #    %o prints a number as an ordinal, with the appropriate suffix ("st",
  155. #    "nd", "rd", or "th" in English) appended; for example, "%od" prints
  156. #    the day of the month as "1st", "2nd", "3rd", etc.
  157. #
  158. #    Unlike strftime(), Pcal's default is to print numbers (except %y)
  159. #    without leading zeroes.  If leading zeroes are desired, the '0' prefix
  160. #    may be used; for example, "%0j" prints the day of year as 001-365.
  161. #
  162. #    %+ and %- direct Pcal to substitute the following/previous month/year
  163. #    in the following [bBmyY] specifier; for example, "%+B" prints the name
  164. #    of the next month.
  165. #
  166. #    %{[+-]N}[DWMY] do not print anything, but instead adjust the working
  167. #    date by +-N days (D), weeks (W), months (M), or years (Y); subsequent
  168. #    format specifiers use the adjusted date instead of the current date.
  169. #    For example, "%+1M %B %Y" adjusts the date forward by one month and
  170. #    then prints the resulting month and year ("January 1991" in December,
  171. #    1990); "%-2W %b %d" adjusts the date backward by two weeks and prints
  172. #    the resulting month and day ("Jul 26" on August 9).
  173. #
  174. #    Such date adjustments are normally cumulative; for example, "%+1Y%-1D"
  175. #    adjusts the date forward by one year and then backward by one day.  If
  176. #    %D or %M is specified alone (or if N is zero), Pcal restores the
  177. #    original date.  (Note that %M has a different meaning to strftime().)
  178. #
  179. #    The "Notes" box uses the first of the current month as the default
  180. #    date.  All foot strings use the first of the current month in single-
  181. #    month mode and the first of the starting month in whole-year mode.
  182. #
  183. #
  184. #    3) Preprocessing:
  185. #
  186. #    Simple cpp-like functionality is provided.  The date file may include
  187. #    the following commands, which work like their cpp counterparts:
  188. #
  189. #        define <sym>
  190. #        undef <sym>
  191. #
  192. #        if{{n}def} <expr>
  193. #           ...
  194. #        { elif <expr>
  195. #           ... }*
  196. #        { else
  197. #           ... }
  198. #        endif
  199. #
  200. #        include{?} <file>
  201. #
  202. #    Note that these do not start with '#', which is reserved as a comment
  203. #    character.
  204. #
  205. #    <sym> is a symbol name consisting of a letter followed by zero or more
  206. #    letters, digits, or underscores ('_').  Symbol names are always
  207. #    treated in a case-insensitive manner.
  208. #
  209. #    <expr> is an expression consisting of symbol names joined by the
  210. #    logical operators (in order of precedence, high to low) '!'  (unary
  211. #    negate), '&' (and), '^' (exclusive or), and '|' (inclusive or).  '&&'
  212. #    and '||' are accepted as synonyms for '&' and '|' respectively; the
  213. #    order of evaluation may be altered by the use of parentheses.  A
  214. #    symbol whose name is currently defined evaluates to TRUE; one whose
  215. #    name is not currently defined evaluates to FALSE.  Thus "ifdef A | B |
  216. #    C" is TRUE if any of the symbols A, B, and C is currently defined, and
  217. #    "ifdef A & B & C" is TRUE if all of them are.
  218. #
  219. #    "ifndef A | B | C" is equivalent to "ifdef !(A | B | C)" (or, using
  220. #    DeMorgan's Law, "ifdef !A & !B & !C") - in other words, TRUE if none
  221. #    of the symbols A, B, and C is currently defined.
  222. #
  223. #    "if" is accepted as a synonym for "ifdef".
  224. #
  225. #    "elif A" is TRUE if A is defined.  Multiple "elif" clauses may appear;
  226. #    at most one "if{{n}def}", "elif", or "else" clause in a given block
  227. #    will be processed.
  228. #
  229. #    "define" alone deletes all the current definitions; "if{def}" alone is
  230. #    always false; "ifndef" alone is always true.
  231. #
  232. #    The file name in the "include" directive may optionally be surrounded
  233. #    by "" or <>; in any case, path names are taken to be relative to the
  234. #    location of the file containing the "include" directive.  If the
  235. #    string "%y" appears in the file name, it is replaced by the last two
  236. #    digits of the current year.  The alternate form, "include?", directs
  237. #    pcal to silently continue if the specified file cannot be opened. 
  238. #
  239. #
  240. #    4) Miscellaneous:
  241. #
  242. #    The "-w" flag defines the symbol "whole_year", which may be tested in
  243. #    the same manner as any user-defined symbol.
  244. #
  245. #    Pcal also supports several predefined holidays; type "pcal -h" to
  246. #    generate a list of these.
  247.  
  248.  
  249. # "opt" lines to override program defaults
  250.  
  251. # select alternate fonts (try the Helvetica fonts if your printer doesn't
  252. # support AvantGarde)
  253. opt -d AvantGarde-Book/30 -t AvantGarde-Book -n Helvetica/8
  254. #opt -d Helvetica-Bold/30 -t Helvetica-Bold -n Helvetica/8
  255.  
  256. opt -A            # dates below are American-style
  257.  
  258. opt -s 0.6/0.97        # override default date/fill box shading
  259. opt -M             # moon icons on all days
  260. ifndef whole_year
  261. opt -O            # print outlined characters if "-w" NOT specified
  262. endif
  263.  
  264. year 1994            # set year explicitly
  265.  
  266. # include file "birthdays" if it exists; continue silently if it doesn't
  267.  
  268. include? birthdays        # add personal list of birthdays
  269.  
  270. # note to be propagated to "Notes" box (-2 = bottom center) for all months
  271.  
  272. opt -N Meetings:        # alternate header for notes box
  273. note/-2 all            Engineering staff meeting every Tuesday, 1:30 PM
  274.  
  275. # examples of format specifiers
  276.  
  277. all Monday in all        Fiscal week %W.%y    # e.g. 26.91
  278. last workday in all        %B status meeting    # substitute month name
  279. 2nd workday in all        %-B status report due    # use previous month
  280.  
  281. # some sample US holidays (flagged by '*') and other days of note
  282.  
  283. 1/1*                New Year's Day
  284. 3rd Monday in Jan*        Martin Luther King Day
  285.  
  286. 3rd Monday in Feb        Presidents' Day
  287. Feb 14                Valentine's Day
  288.  
  289. # any Pcal users in Alaska?
  290. ifdef AK
  291. fifth Sat on_or_after 02/01    Iditarod starts
  292. endif
  293.  
  294. 3/17                St. Patrick's Day
  295.  
  296. # Easter is a predefined holiday, calculated by Pcal for each year
  297.  
  298. Easter*                Easter Sunday
  299.  
  300. first Sunday in April        DST begins
  301.  
  302. # another local holiday - included only if "MA" or "ME" defined
  303. ifdef MA || ME
  304. 3rd Monday in Apr        Patriots' Day (MA, ME)
  305. endif
  306.  
  307. last Monday in May*        Memorial Day
  308.  
  309. 6/14                Flag Day
  310.  
  311. 7/4*                Independence Day
  312.  
  313. 8/9                Dilbert's tie flat, 1994
  314.  
  315. 1st Monday in Sep*        Labor Day
  316.  
  317. second Monday in Oct*        Columbus Day (observed)
  318. last Sunday in Oct        DST ends
  319. 10/31                Halloween
  320.  
  321. Tue after first Mon in Nov    Election Day
  322. 11/9                \"Louie Louie\" enters Billboard chart, 1963
  323. 11/11*                Veterans' Day # (observed)
  324.  
  325. # Thanksgiving and Christmas are also predefined holidays
  326.  
  327. Thanksgiving*            Thanksgiving Day
  328. day after fourth Thu in Nov*
  329.  
  330. day before Christmas*         Christmas Eve
  331. Christmas*            Christmas Day
  332. last day in Dec*        New Year's Eve
  333.  
  334. # if the symbol "paydays" has been defined, print text on alternate
  335. # Fridays (starting with the second Friday of the year)
  336. ifdef paydays
  337. even Fridays in year        Pay Day
  338. endif
  339.  
  340. # not every month will have a second full moon; '?' suppresses warning message
  341. 2nd full_moon in all?        Blue Moon
  342.  
  343. # if the symbol "meetings" has been defined, print text on the next-to-last
  344. # Monday of each month
  345. ifdef meetings
  346. -2nd Monday in all        Monthly staff meeting
  347. endif
  348.  
  349. # if the symbol "whole_year" has been defined (either explicitly or implicitly
  350. # via "-w"), print a center foot string containing the first and last dates of
  351. # the year
  352. ifdef whole_year
  353. opt -C "Fiscal year %B %d, %Y - %+1Y%-1D%B %d, %Y"
  354. endif
  355.  
  356. 1/1/95*                New Year's Day        # reset year implicitly
  357.